package user

import (
	"day12_11_homework/internal/models/response"
	"day12_11_homework/internal/models/service"
	"github.com/gin-gonic/gin"
)

func DelUser(c *gin.Context) {
	value, _ := c.Get("userId")

	id, user := response.DelUser(value)

	if user != "" {
		c.JSON(500, gin.H{
			"message": user,
		})
	}

	delUser := service.DelUser(id)

	if delUser != "" {
		c.JSON(500, gin.H{
			"message": delUser,
		})
	}

	c.JSON(200, gin.H{
		"message": "注销成功",
	})

}
